import tensorflow as tf
from tensorpack.tfutils.scope_utils import under_name_scope
from tensorpack.models import *
from tensorpack.train import TrainConfig, SimpleTrainer
from tensorpack.utils.gpu import get_num_gpu
...

@under_name_scope()
def your_custom_layer(input_tensor):
    ...

class YourNet(ModelDesc):
    def inputs(self):
        return [...]
    
    def build_graph(self, *inputs):
        ...
        
    def optimizer(self):
        lr = tf.get_variable('learning_rate', initializer=0.01, trainable=False)
        opt = tf.train.AdamOptimizer(lr)
        return opt


if __name__ == '__main__':
    config = TrainConfig(
        data=QueueInput(ds),
        callbacks=[...],
        model=YourNet(),
        steps_per_epoch=500,
        max_epoch=200,)
    trainer = SimpleTrainer(config=config)
    launch_train_with_config(config, trainer)